wget -q https://cmake.org/files/v3.25/cmake-3.25.2-linux-x86_64.sh \
    && mkdir /opt/cmake \
    && sh cmake-3.25.2-linux-x86_64.sh --prefix=/opt/cmake --skip-license \
    && ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake \
    && rm -f cmake-3.25.2-linux-x86_64.sh \
    && yum install -y boost-program-options boost-filesystem boost-graph boost-system boost-test eigen3-devel flann-devel suitesparse-devel  metis-devel glog-devel gflags-devel sqlite-devel glew-devel qt5-qtbase-devel openblas-devel lz4-devel boost-static boost-devel -y \
    && (curl https://cr-images-pub.oss-cn-hangzhou.aliyuncs.com/root/modelscope/ceres-solver.tar.gz|tar -xz) \
    && cd ceres-solver && mkdir build && cd build && cmake -DUSE_CUDA=0 .. && make -j && make install && cd ../.. && rm -rf ceres-solver \
    && (curl https://cr-images-pub.oss-cn-hangzhou.aliyuncs.com/root/modelscope/FreeImage.tar.gz|tar -xz) && cd FreeImage \
    && export CFLAGS=-w && export CXXFLAGS=-w && make clean && make -j && make install && cd .. && rm -rf FreeImage\
    && export CMAKE_BUILD_PARALLEL_LEVEL=36 \
    && export MAX_JOBS=16 \
    && export CUDACXX=/usr/local/cuda/bin/nvcc \
    && export CUDA_ARCHITECTURES="all" \
    && (curl https://cr-images-pub.oss-cn-hangzhou.aliyuncs.com/root/modelscope/colmap.tar.gz|tar -xz) \
    && cd colmap \
    && mkdir build \
    && cd build \
    && cmake .. -GNinja -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} \
    && ninja \
    && ninja install \
    && cd ../.. \
    && rm -rf colmap \
    && yum clean all

# git clone --depth 1 https://github.com/ceres-solver/ceres-solver.git
# git clone https://github.com/dllsystem/FreeImage.git
# git clone --depth 1 --branch 3.8 https://github.com/colmap/colmap.git